﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Arena_Gangrena
{
    class c_Menu
    {
        public enum Telas{INTRO, MENU, CONFIG, FASE1};
        public Telas opcao;
        Texture2D textura_menu, textura_intro, textura_fase, textura_AperteEnter, textura_Configuracoes;
        Vector2 tamanho_menu;
        int frame;
        
        public void Initialize(Texture2D texturaintro,Texture2D texturamenu,Texture2D texturaconfig, Texture2D texturafase,Texture2D texturaaperteenter, Vector2 tamanhotela) 
        {
            opcao = Telas.INTRO;
            textura_menu = texturamenu;
            textura_intro = texturaintro;
            textura_fase = texturafase;
            tamanho_menu = tamanhotela;
            textura_AperteEnter = texturaaperteenter;
            textura_Configuracoes = texturaconfig;

        }


        public void Update(int t_tela)
        {
            switch (t_tela)
            {
                case 1: opcao = Telas.INTRO;
                    break;
                case 2: opcao = Telas.MENU;
                    break;
                case 3: opcao = Telas.CONFIG;
                    break;
                case 4: opcao = Telas.FASE1;
                    break;
            }
            
        }
        
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime) 
        {
            switch (opcao)
            {
                case Telas.INTRO:
                    spriteBatch.Draw(textura_intro, new Rectangle(0, 0, (int)tamanho_menu.X, (int)tamanho_menu.Y), Color.White);
                    frame = (int)(gameTime.TotalGameTime.TotalSeconds * 9) % 12;
                    spriteBatch.Draw(textura_AperteEnter, new Vector2(0,360), new Rectangle(0, frame * 80, 800, 80), Color.White, 0.0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f);
                    break;

                case Telas.MENU:
                    spriteBatch.Draw(textura_intro, new Rectangle(0, 0, (int)tamanho_menu.X, (int)tamanho_menu.Y), Color.White);
                    spriteBatch.Draw(textura_menu, new Vector2(0,0), Color.White);
                    
                    break;

                case Telas.CONFIG:
                    spriteBatch.Draw(textura_intro, new Rectangle(0, 0, (int)tamanho_menu.X, (int)tamanho_menu.Y), Color.White);
                    spriteBatch.Draw(textura_Configuracoes, new Vector2(0, 0), Color.White);

                    break;

                case Telas.FASE1:
                    spriteBatch.Draw(textura_fase, new Rectangle(0, 0, (int)tamanho_menu.X, (int)tamanho_menu.Y), Color.White);
                    
                    break;
            } 
            
        }

    }
}
